<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="com.pmsco.pms.core.constant.PmsConstant"%>
<%@ page import="com.pmsco.pms.util.BundleUtil"%>
<%@ include file="/WEB-INF/import/tagLibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script>
	    $(function() {
	        $("#dob").datepicker({
	        	dateFormat: '<%=BundleUtil.getInstance().getKey("date.format")%>',
	        	changeMonth: true,
	            changeYear: true,
	            yearRange: "<%=BundleUtil.getInstance().getKey("date.yearRanges")%>",
	            defaultDate: "<%=BundleUtil.getInstance().getDefaultDate()%>"
        	});
	        
	        $("button").button();
	    });
    </script>
</head>
<body class="pmsMainBody">
	<table class="pmsMainTable">
		<tr class="pmsMainTableWrapperTd">
			<td>
			    <table class="tableForm">
			    	<input type="hidden" id="id" name="id" value="${command.id}"/>
			    	<c:if test="${errorMessage != null}">
			    		<tr><td colspan="2" class="tableFormLabelRequired"><spring:message code="${errorMessage}"/></td></tr>	
			    	</c:if>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.userName"/></td>
						<td><input type="text" class="talbeFormTextBox" id="userName" name="userName" value="${command.userName}" size="15" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.password"/></td>
						<td><input type="password" class="talbeFormTextBox" id="password" name="password" value="${command.password}" size="15" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.lastName"/></td>
						<td><input type="text" class="talbeFormTextBox" id="lastName" name="lastName" value="${command.lastName}" size="15" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><spring:message code="user.midName"/></td>
						<td><input type="text" class="talbeFormTextBox" id="midName" name="midName" value="${command.midName}" size="50"/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.firstName"/></td>
						<td><input type="text" class="talbeFormTextBox" id="firstName" name="firstName" value="${command.firstName}" size="15" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><spring:message code="user.role"/></td>
						<td>
							<select id="roleId" name="roleId">
								<c:forEach var="roleItem" items="${roleList}">
									<option value="${roleItem.id}" ${roleItem.id == command.pmsRole.id ? "selected" : ""}>${roleItem.description}</option>
								</c:forEach>
							</select>
						</td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.idNumber"/></td>
						<td><input type="text" class="talbeFormTextBox" id="idNumber" name="idNumber" value="${command.idNumber}" size="15" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.dob"/></td>
						<td><input type="text" class="talbeFormTextBox" id="dob" name="dob" value="<fmt:formatDate value="${command.dob}" pattern="<%=PmsConstant.dateFormat%>"/>" size="15" readonly="true" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><spring:message code="user.cellPhone"/></td>
						<td><input type="text" class="talbeFormTextBox" id="cellPhone" name="cellPhone" value="${command.cellPhone}" size="15"/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><spring:message code="user.homePhone"/></td>
						<td><input type="text" class="talbeFormTextBox" id="homePhone" name="homePhone" value="${command.homePhone}" size="15"/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.homeAddr"/></td>
						<td><input type="text" class="talbeFormTextBox" id="homeAddr" name="homeAddr" value="${command.homeAddr}" size="80" required/></td>
					</tr>
					<tr>
						<td class="tableFormLabel"><label class="tableFormLabelRequired">*&nbsp;</label><spring:message code="user.emailAddr"/></td>
						<td><input type="email" class="talbeFormTextBox" id="emailAddr" name="emailAddr" value="${command.emailAddr}" size="50" required/></td>
					</tr>
					<tr>
						<td colspan="2">
							<table align="center">
								<tr>
									<td>
										<button class="tableFormButton" onclick="return submitAction('<%=PmsConstant.saveUser_JspUrl%>', true)"><spring:message code="button.save"/></button>
									</td>
									<td>
										<button class="tableFormButton" onclick="return confirmAction('<%=PmsConstant.listUser_JspUrl%>', cancelUserDetailTitle, cancelUserDetailMessage)"><spring:message code="button.cancel"/></button>
									</td>
								</tr>
							</table>
						</td>
					</tr>	
				</table>
			</td>
		</tr>
	</table>
</body>
</html>